package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizChannelTypeParam;
import cn.stylefeng.guns.modular.gridsystem.service.BizChannelTypeService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 通道类型 控制器
 *
 * @author: ssy
 * @date: 2022/02/16 10:59
 */
@RestController
public class BizChannelTypeController {

    @Resource
    private BizChannelTypeService bizChannelTypeService;

    /**
     * 分页查询通道类型
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @GetMapping("/bizChannelType/page")
    @BusinessLog(title = "通道类型_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BizChannelTypeParam bizChannelTypeParam) {
        return new SuccessResponseData(bizChannelTypeService.page(bizChannelTypeParam));
    }

    /**
     * 获取全部通道类型
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @GetMapping("/bizChannelType/list")
    @BusinessLog(title = "通道类型_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list() {
        return new SuccessResponseData(bizChannelTypeService.list());
    }

    /**
     * 查看详情通道类型
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @GetMapping("/bizChannelType/detail")
    @BusinessLog(title = "通道类型_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(BizChannelTypeParam.detail.class) BizChannelTypeParam bizChannelTypeParam) {
        return new SuccessResponseData(bizChannelTypeService.detail(bizChannelTypeParam));
    }

    /**
     * 添加通道类型
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @PostMapping("/bizChannelType/add")
    @BusinessLog(title = "通道类型_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(BizChannelTypeParam.add.class) BizChannelTypeParam bizChannelTypeParam) {
        bizChannelTypeService.add(bizChannelTypeParam);
        return new SuccessResponseData();
    }

    /**
     * 删除通道类型
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @PostMapping("/bizChannelType/delete")
    @BusinessLog(title = "通道类型_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(BizChannelTypeParam.delete.class) BizChannelTypeParam bizChannelTypeParam) {
        bizChannelTypeService.delete(bizChannelTypeParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑通道类型
     *
     * @author ssy
     * @date 2022/02/16 10:59
     */
    @PostMapping("/bizChannelType/edit")
    @BusinessLog(title = "通道类型_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(BizChannelTypeParam.edit.class) BizChannelTypeParam bizChannelTypeParam) {
        bizChannelTypeService.edit(bizChannelTypeParam);
        return new SuccessResponseData();
    }

}
